﻿<phone:PhoneApplicationPage 
    xmlns:my="clr-namespace:SoftwareLogistics.SharepointClient.Controls;assembly=SoftwareLogistics.SharepointClient.WP7Library"
    x:Class="SoftwareLogistics.SharepointClient.Project"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:tk="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="728"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneBackgroundBrush}">
        <Grid.Resources>
            <Style TargetType="ListBoxItem" x:Key="ListItem">
                <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                <Setter Property="Margin" Value="4" />
                <Setter Property="Padding" Value="4" />
                <Setter Property="Background" Value="#090909" />
            </Style>
        </Grid.Resources>
        <!--Pivot Control-->
        <controls:Pivot Title="{StaticResource AppTitle}" x:Name="MainPivot">
            <!--Pivot item one-->
            <controls:PivotItem Header="time" Tag="Time" x:Name="TimePivot" >
                <StackPanel>
                    <tk:PerformanceProgressBar x:Name="TimePB" Visibility="Collapsed" IsIndeterminate="False" VerticalAlignment="Top" />
                    <ListBox x:Name="TimeList" SelectionChanged="Row_SelectionChanged" ItemContainerStyle="{StaticResource ListItem}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel>
                                    <my:GridTextBlock Field="{Binding Columns}" FieldName="Title" FontSize="28" />
                                    <my:GridTextBlock Field="{Binding Columns}" FieldName="Task" FormatType="LinkedRecord" FontSize="24" />
                                    <StackPanel Orientation="Vertical">
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="by: " Foreground="{StaticResource PhoneSubtleBrush}" Width="120" />
                                            <my:GridTextBlock Field="{Binding Columns}" FieldName="User" FormatType="User"  />
                                        </StackPanel>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="date: " Foreground="{StaticResource PhoneSubtleBrush}" Width="120" />
                                            <my:GridTextBlock Field="{Binding Columns}" FieldName="Work Date" FormatType="Date" />
                                        </StackPanel>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="hours: " Foreground="{StaticResource PhoneSubtleBrush}" Width="120" />
                                            <my:GridTextBlock Field="{Binding Columns}" FieldName="Hours Worked" FormatType="Hours" />
                                        </StackPanel>
                                    </StackPanel>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </StackPanel>
            </controls:PivotItem>

            <!--Pivot item two-->
            <controls:PivotItem Header="tasks" Tag="Tasks" x:Name="TaskPivot" >
                <StackPanel>
                    <tk:PerformanceProgressBar x:Name="TaskPB" Visibility="Collapsed" IsIndeterminate="False" VerticalAlignment="Top" />
                    <ListBox x:Name="TasksList" SelectionChanged="Row_SelectionChanged" ItemContainerStyle="{StaticResource ListItem}" >
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="120" />
                                    </Grid.ColumnDefinitions>
                                    <my:GridTextBlock Field="{Binding Columns}" FieldName="Title" FontSize="28" Grid.Row="0" />
                                    <my:GridTextBlock Field="{Binding Columns}" FieldName="Project" FormatType="LinkedRecord" Grid.Row="1" FontSize="24" />
                                    <StackPanel Grid.Row="2" >
                                        <StackPanel Orientation="Horizontal"  >
                                            <TextBlock Text="assigned:" Width="120" Foreground="{StaticResource PhoneSubtleBrush}" />
                                            <my:GridTextBlock Field="{Binding Columns}" FieldName="AssignedTo" FormatType="User" />
                                        </StackPanel>
                                        <StackPanel Orientation="Horizontal"  >
                                            <TextBlock Text="priority:" Width="120" Foreground="{StaticResource PhoneSubtleBrush}" />
                                            <my:GridTextBlock Field="{Binding Columns}" FieldName="Priority" />
                                        </StackPanel>
                                        <StackPanel Orientation="Horizontal"  >
                                            <TextBlock Text="status:" Width="120" Foreground="{StaticResource PhoneSubtleBrush}" />
                                            <my:GridTextBlock Field="{Binding Columns}" FieldName="Status"  />
                                        </StackPanel>
                                    </StackPanel>

                                    <Button x:Name="AddTime" Content="Time" Grid.RowSpan="3" Grid.Column="1" Click="AddTime_Click" Tag="{Binding}" />
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </StackPanel>
            </controls:PivotItem>
            <controls:PivotItem Header="project" Tag="Project" x:Name="ProjectPivot">
                <StackPanel>
                    <tk:PerformanceProgressBar x:Name="ProjectPB" Visibility="Collapsed" IsIndeterminate="False" VerticalAlignment="Top" />
                    <ListBox x:Name="ProjectList" SelectionChanged="Row_SelectionChanged" ItemContainerStyle="{StaticResource ListItem}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="120" />
                                    </Grid.ColumnDefinitions>
                                    <my:GridTextBlock Field="{Binding Columns}" FieldName="Title" FontSize="28" />
                                    <StackPanel Grid.Row="1" >
                                        <StackPanel Grid.Row="1" Orientation="Horizontal">
                                            <TextBlock Text="portfolio:" Width="120" Foreground="{StaticResource PhoneSubtleBrush}"/>
                                            <my:GridTextBlock Field="{Binding Columns}" FieldName="Portfolio" FormatType="User" />
                                        </StackPanel>
                                        <StackPanel Grid.Row="1" Orientation="Horizontal">
                                            <TextBlock Text="status: " Width="120" Foreground="{StaticResource PhoneSubtleBrush}"/>
                                            <my:GridTextBlock Field="{Binding Columns}" FieldName="Status"  />
                                        </StackPanel>
                                    </StackPanel>
                                    <Button x:Name="AddTask" Content="Task" Grid.RowSpan="2" Grid.Column="1" Click="AddTask_Click" Tag="{Binding}" />
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </StackPanel>
            </controls:PivotItem>

        </controls:Pivot>
        <StackPanel x:Name="FilterPanel" Visibility="Collapsed" VerticalAlignment="Bottom"  Background="#303030" >
            <ListBox  SelectionChanged="Filter_SelectionChanged" Margin="12,12,12,24"  x:Name="Filter" >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock FontSize="34" Text="{Binding Name}" />
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </StackPanel>
    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/filter.png" Text="save" x:Name="FilterButton" Click="FilterButton_Click" />
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="settings" x:Name="SettingsMenu"/>
                <shell:ApplicationBarMenuItem Text="about" x:Name="AboutMenu"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>


</phone:PhoneApplicationPage>